import axios from 'axios'

export default {
    /**
     * 获取列表数据
     * @param params
     * @returns {AxiosPromise<any>}
     */
    fetch (params) {
        return axios.get('an/service/user', {
            params: params
        });
    },
    /**
     * 根据id获取详情
     */
    fetchById(id,params){
        return axios.get(`an/service/user/${id}`,{
            params: params
        });
    },
    /**
     * 创建用户
     * @param params
     * @returns {AxiosPromise<any>}
     */
    create(params){
        return axios.post('an/service/user',params);
    },
    /**
     * 删除用户
     * @param id
     * @returns {AxiosPromise<any>}
     */
    destroy(id){
        return axios.delete(`an/service/user/${id}`);
    },
    /**
     * 修改用户
     * @param id
     * @param params
     * @returns {AxiosPromise<any>}
     */
    update(id,params){
        return axios.patch(`an/service/user/${id}`, params);
    }
}
